Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mercuryworkshop/bare-mux

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mercuryworkshop/bare-mux

A system for managing http transports in a project such as [Ultraviolet](https://github.com/Titaniumnetwork-dev/Ultraviolet).

  • 1.1.4
  • legacy
  • npm
  • Socket score

Version published
Weekly downloads
3.4K
increased by27.12%
Maintainers
6
Weekly downloads
 
Created
Source

Bare-Mux

A system for managing http transports in a project such as Ultraviolet.

Written to make the job of creating new standards for transporting http data seamless.

Implements the TompHTTP Bare client interface in a modular way.

Specifically, this is what allows proxies such as Nebula to switch HTTP transports seamlessly.

A transport is a module that implements the BareTransport interface.

export interface BareTransport {
  init: () => Promise<void>;
  ready: boolean;
  connect: (
    url: URL,
    origin: string,
    protocols: string[],
    requestHeaders: BareHeaders,
    onopen: (protocol: string) => void,
    onmessage: (data: Blob | ArrayBuffer | string) => void,
    onclose: (code: number, reason: string) => void,
    onerror: (error: string) => void,
  ) => [( (data: Blob | ArrayBuffer | string) => void, (code: number, reason: string) => void )] => void;

  request: (
    remote: URL,
    method: string,
    body: BodyInit | null,
    headers: BareHeaders,
    signal: AbortSignal | undefined
  ) => Promise<TransferrableResponse>;

  meta: () => BareMeta
}

Examples of transports include EpoxyTransport, CurlTransport, and Bare-Client.

To switch between transports, use the SetTransport function.

import { SetTransport } from '@mercuryworkshop/bare-mux';

SetTransport("EpxMod.EpoxyClient", { wisp: "wss://wisp.mercurywork.shop" });
SetTransport("BareMod.BareClient", "https://some-bare-server.com");

If not using a bundler, extract the npm package in releases, and include the bare.cjs file and call BareMux.SetTransport.

FAQs

Package last updated on 03 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc